<script>
_h=h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>750){sWidth=750;}
var _rate=(sWidth/750);
if(h<_rate*1206){h=_rate*1206;}
var _img=['m.png'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('./img/'+_img[i]);}
loader.start();
 
loader.addCompletionListener(function(e){
	   $(".p1").fadeIn(800).css({"opacity":1});
});
$(function(){
	document.body.addEventListener('touchmove', function (e) {
		  e.preventDefault();  
	}, {passive: false});
	$('.container, .bigbg, .p19bg').width(sWidth).height(h);
	$('.thebg, .p-b, .p19x').width(sWidth).height(_rate*1206);
	$('.arw').width(_rate*41).height(_rate*46).css({"left":_rate*354});
	$('.p1-t1, .p1-t2').css({"top":0});
	$('.p1-t3').css({"top":_rate*450});
	$('.p1-t4').width(_rate*136).height(_rate*130).css({"top":_rate*848, "left":_rate*310});
	$('.p1-t5').css({"top":_rate*944});
	$('.g1').width(_rate*108).height(_rate*42).css({"top":_rate*48, "left":70});
	$('.g2').width(_rate*169).height(_rate*19).css({"top":_rate*146, "left":_rate*170});
 
	$('.p2-t1').css({"top":_rate*160});
	$('.p2-t2').css({"top":_rate*956});

	$('.p3-t2').css({"top":_rate*424});
	$('.p3-t3').css({"top":_rate*692});
	$('.p4-t1').css({"top":0});
	$('.p4-t2').css({"top":_rate*928});
	$('.p4-t3').css({"top":_rate*1052});
	$('.p5-g2').css({"top":_rate*214});

	$('.p5-t1').css({"top":_rate*370});
	$('.p5-t2').css({"top":_rate*652});
	$('.p5-t3').css({"top":_rate*718});
	$('.p5-t4').css({"top":_rate*1032});

	$('.p6-t1').css({"top":_rate*164});
	$('.p6-t2').css({"top":_rate*432});
	$('.p6-t3').css({"top":_rate*516});

	$('.p7-t1').css({"top":_rate*260});
	$('.p7-t2').css({"top":_rate*268});
	$('.p7-t3').css({"top":_rate*544});
	$('.p7-t4').css({"top":_rate*718});
	$('.p7-t5').css({"top":_rate*932});
	$('.p8-t1').css({"top":0});
	$('.p8-t2').css({"top":_rate*140});
	$('.p8-t3').css({"top":_rate*548});
	$('.p8-t4').css({"top":_rate*650});
	$('.p8-t5').css({"top":_rate*1072});
	$('.p9-t1').css({"top":0});
	$('.p9-t2').css({"top":_rate*136});
	$('.p9-t3').css({"top":_rate*562});
	$('.p9-t4').css({"top":_rate*650});
	$('.p9-t5').css({"top":_rate*1028});

	$('.p10-t1').css({"top":0});
	$('.p10-t2').css({"top":_rate*496});
	$('.p10-t3').css({"top":_rate*728});
	$('.p10-t4').css({"top":_rate*860});
	$('.p10-t5').css({"top":_rate*1048});

	$('.p11-t1').css({"top":0});
	$('.p11-t2').css({"top":_rate*612});
	$('.p11-t3').css({"top":_rate*782});
	$('.p11-t4').css({"top":_rate*824});
	$('.p11-t5').css({"top":_rate*1046});

	$('.p13-t1').css({"top":_rate*246});
	$('.p13-t2').css({"top":_rate*362});
	$('.p13-t3').css({"top":_rate*742});
	$('.p13-t4').css({"top":_rate*872});

	$('.p14-t1').css({"top":0});
	$('.p14-t2').css({"top":_rate*220});
	$('.p14-t3').css({"top":_rate*600});
	$('.p14-t4').css({"top":_rate*813});

	$('.p15-t1').css({"top":0});
	$('.p15-t2, .p15-t2-1').css({"top":_rate*252});
	$('.p15-t3, .p15-t3-1').css({"top":_rate*658});

	$('.p16-t1').css({"top":_rate*266});
	$('.p16-t2').css({"top":_rate*560});
	$('.p16-t3').css({"top":_rate*956});

	$('.p17-t1').css({"top":_rate*276});
	$('.p17-t2').css({"top":_rate*503});
	$('.p17-t3').css({"top":_rate*892});
	
	$('.p18-t1').css({"top":_rate*322});
	$('.p18-t2, .p18-t2-2').css({"top":_rate*420});
	$('.p18-t3, .p18-t3-2').css({"top":_rate*720});
	$('.p18-t4').css({"top":_rate*352});
	
	$('.p-s').width(_rate*750).height(h); 
	var swiper = new Swiper('.p-s', {
		   initialSlide:0,
		   direction:'vertical',
		   speed:400,
		   on:{
		        transitionStart: function(){
		        	$('.g1').hide().css({"left":70, 'opacity':1});
		        	$('.g2').hide().css({"left":_rate*170, 'opacity':1});
		        	$(".animated, .arw").hide();
		        	if(0 == this.activeIndex){
		        	  $(".p1-t4").removeClass("arr");
		        	}
		        },
		        transitionEnd: function(swiper){
		        	$(".arw").show();
		        	if(0 == this.activeIndex){
				        $(".p1-t1, .p1-t2, .p1-t3, .p1-t4, .p1-t5").show();
				        window.setTimeout(function(){
				        	$(".p1-t4").addClass("arr");
					        }, 3400);
				        return;
					}
			        if(1 == this.activeIndex){
			           $(".p1-t4").removeClass("arr");
			           $(".p2-t1, .p2-t2").show();
                       $(".p2 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
                       $(".p2 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
                       return;
   				    }
			        if(2 == this.activeIndex){
			        	$(".p3-t1, .p3-t2, .p3-t3").show();return;
				    }
			        if(3 == this.activeIndex){
			        	$(".p4-t1, .p4-t2, .p4-t3").show();return;
				    }
			        if(4 == this.activeIndex){
				           $(".p5-t1, .p5-t2, .p5-t3, .p5-t4").show();
	                       $(".p5 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                       $(".p5 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
	                       return;
	   				}
			        if(5 == this.activeIndex){
				           $(".p6-t1, .p6-t2, .p6-t3").show();
	                       $(".p6 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                       $(".p6 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
	                       return;
	   				}
			        if(6 == this.activeIndex){
				           $(".p7-t1, .p7-t2, .p7-t3, .p7-t4, .p7-t5").show();
	                       $(".p7 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                       $(".p7 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
	                       return;
	   				}
			        if(7 == this.activeIndex){
				           $(".p8-t1, .p8-t2, .p8-t3, .p8-t4, .p8-t5").show();
				           return;
					}
			        if(8 == this.activeIndex){
				           $(".p9-t1, .p9-t2, .p9-t3, .p9-t4, .p9-t5").show();
				           return;
					}
			        if(9 == this.activeIndex){
				          $(".p10-t1, .p10-t2, .p10-t3, .p10-t4, .p10-t5").show();
				          return;
					}
			        if(10 == this.activeIndex){
				        $(".p11-t1, .p11-t2, .p11-t3, .p11-t4, .p11-t5").show();   
				        return;
					}
			        if(11 == this.activeIndex){
			        	$(".p13 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                    $(".p13 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
				        $(".p13-t1, .p13-t2, .p13-t3, .p13-t4").show();
				        return;   
					}
					if(12 == this.activeIndex){
				        $(".p14-t1, .p14-t2, .p14-t3, .p14-t4").show();
				        return;   
					}
					if(13 == this.activeIndex){
				        $(".p15-t1, .p15-t2, .p15-t3, .p15-t2-1, .p15-t3-1").show();   
				        return;
					}
					if(14 == this.activeIndex){
			        	$(".p16 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                    $(".p16 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
				        $(".p16-t1, .p16-t2, .p16-t3").show(); 
				        return;  
					}
					if(15 == this.activeIndex){
			        	$(".p17 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                    $(".p17 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
				        $(".p17-t1, .p17-t2, .p17-t3").show();
				        return;   
					}
					if(16 == this.activeIndex){
			        	$(".p18 .g1").show().animate({'left':_rate*520,'opacity':0},1000);
	                    $(".p18 .g2").show().animate({'left':_rate*540,'opacity':0},1000);
				        $(".p18-t1, .p18-t2, .p18-t3, .p18-t2-2, .p18-t3-2, .p18-t4").show();   
				        return;
					}
					if(17 == this.activeIndex){
						$(".p19x").show();
					}
			        console.log(this.activeIndex);
		        	//$(".p2-logo, .p2-logobg").show();
		          }
		        }
	    } );
	window.setTimeout(function(){
    	$(".p1-t4").addClass("arr");
        }, 3400);
	if(h > _rate*1206){
		   var _cha= (h - _rate*1306)/2;
		   if(_cha > 0){
		      $('.thebg').css({"top":_cha});
		      $(".p2x").attr("src","./img/p2-x.jpg");
		      $(".p3x").attr("src","./img/p3-x.jpg");
		      $(".p4x").attr("src","./img/p4-x.jpg");
		      $(".p5x").attr("src","./img/p5-x.jpg");
		      $(".p6x").attr("src","./img/p6-x.jpg");
		      $(".p7x").attr("src","./img/p7-x.jpg");
		      $(".p8x").attr("src","./img/p8-x.jpg");
		      $(".p9x").attr("src","./img/p9-x.jpg");
		      $(".p10x").attr("src","./img/p10-x.jpg");
		      $(".p11x").attr("src","./img/p11-x.jpg");
		      $(".p13x").attr("src","./img/p13-x.jpg");
		      $(".p19x").attr("src","./img/p19-x2.jpg");
		      $('.p19x').height(_rate*1464);
		      
		   }
    }

	wx.config({
        appId: '<?php echo $signPackage["appId"];?>',timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage','onMenuShareQQ','showMenuItems','showOptionMenu']
    });
    wx.ready(function () {
    		var _title='URARA';
    		var _desc='恒采之能奢宠系列商谈手册';
    		var _link='http://urara.mei94.com/';
    		var _imgUrl='http://urara.mei94.com/img/6.jpg';
    			wx.onMenuShareTimeline({title: _desc, link: _link, imgUrl: _imgUrl,success: function () {
    			},cancel: function () { 
    			}});
    			wx.onMenuShareAppMessage({ title: _title, desc: _desc,link: _link,imgUrl: _imgUrl, type: '', dataUrl: '', success: function () {
    			},cancel: function () { 
    			}});
    });
	 
  
});
</script>